package com.property.controller;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.property.biz.ComplaintBiz;
import com.property.biz.DisposeBiz;
import com.property.entity.Complaint;
import com.property.entity.ComplaintDispose;
import com.property.entity.Management;

@Controller

public class DisposeController {
	
	@Autowired
	private DisposeBiz disposeBiz;
	@Autowired
	private ComplaintBiz complaintBiz;
	
	@RequestMapping("/dispose")
	public String dispose(HttpSession session,int comid,String content){
		Management user= (Management) session.getAttribute("management");
		ComplaintDispose complaintDispose=new ComplaintDispose();
		Complaint complaint=new Complaint();
		Management management=new Management();
		complaint.setId(comid);
		management.setId(user.getId());
		complaintDispose.setComplaint(complaint);
		complaintDispose.setManagement(management);
		complaintDispose.setReplyContent(content);
		disposeBiz.inDispose(complaintDispose);
		
		return "redirect:main/complaint";
	}
	@RequestMapping("/disposes")
	public String disposes(HttpSession session,int comid,String content){
		Management user= (Management) session.getAttribute("management");
		ComplaintDispose complaintDispose=new ComplaintDispose();
		Complaint complaint=new Complaint();
		Management management=new Management();
		complaint.setId(comid);
		management.setId(user.getId());
		complaintDispose.setComplaint(complaint);
		complaintDispose.setManagement(management);
		complaintDispose.setReplyContent(content);
		disposeBiz.inDispose(complaintDispose);
		
		return "redirect:main/complaa";
	}
	
	
}
